<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="/Css/admin/ui-v1.0.css" rel="stylesheet" type="text/css" media="all">
<script type="text/javascript" src="/js/jquery/jquery-1.4.4.min.js"></script>
<script type="text/javascript" src="/js/jquery/jquery-ui-1.8.10.custom.min.js"></script>
<script type="text/javascript" src="/js/admin/v3.2.js"></script>
<script type="text/javascript">
$(function(){
   $.fn.liveDraggable = function (opts) {       this.live("mouseover", function() {          if (!$(this).data("init")) {             $(this).data("init", true).draggable(opts);          }       });    }; 
	$('#btnSearch').click(function(){
		//$('#frmSearch').submit();
		$.loadContent('#addresslist','读取联系人',{query:'type='+$('#type').val()+'&keyword='+$('#keyword').val()})
	});
	$('#btnSend').button()
		.click(function(){
		var query = $('#frmSendMail').serialize()
		$.ajax({type:'post',
			/*beforeSend : function(xhr){	xhr.setRequestHeader("HTTP_X_XMLHTTP_MODE", "true"); },*/
			url:'/sendmail.html',
			data: query,
			complete:function(xhr){
				$._result(xhr.responseText,function(code,info){
					alert(info);
				})
			}				
			})
	});
	$('#frmSendMail').submit(function(){
		return false;
	});
	$('#btnSmsSend').button().click(function(){
		var query = $('#frmSendMail').serialize()
		$.ajax({type:'post',
			/*beforeSend : function(xhr){	xhr.setRequestHeader("HTTP_X_XMLHTTP_MODE", "true"); },*/
			url:'/sendsms.html',
			data: query,
			complete:function(xhr){
				$._result(xhr.responseText,function(code,info){
					alert(info);
				})
			}				
			})
	});
	var $addresslist = $( "#addresslist" ),
			$selected = $( "#selectedcontainer" );
			
	$( "li", $addresslist ).liveDraggable({
			cancel: "a.ui-icon", // clicking an icon won't initiate dragging
			revert: "invalid", // when not dropped, the item will revert back to its initial position
			containment: $( "#demo-frame" ).length ? "#demo-frame" : "document", // stick to demo-frame if present
			helper: "clone",
			cursor: "move"
		});
	$selected.droppable({
			accept: "#addresslist > li",
			activeClass: "ui-state-highlight",
			drop: function( event, ui ) {
				add( ui.draggable );
			}
		});
	$addresslist.droppable({
			accept: "#selectedcontainer li",
			activeClass: "ui-state-highlight",
			drop: function( event, ui ) {
				remove( ui.draggable );
			}
		});
	function add( $item ) {
			$item.fadeOut(function() {
				var $list = $( "ul", $selected ).length ?
					$( "ul", $selected ) :
					$( "<ul class='ui-helper-reset'/>" ).appendTo( $selected );

				$item.appendTo( $list ).fadeIn(function() {
					$item
						.find( "span.ui-icon-circle-plus" )
							.removeClass('ui-icon-circle-plus')
							.addClass('ui-icon-circle-minus');
				});
			});
		}
	function remove( $item ) {
			$item.fadeOut(function() {
				$item
					.find( "span.ui-icon-circle-minus" )
							.removeClass('ui-icon-circle-minus')
							.addClass('ui-icon-circle-plus')
					.end()
					.appendTo( $addresslist )
					.fadeIn();
			});
		}
	$( "#addresslist > li" ).live('dblclick',function(){
		var $item = $( this );
		add( $item );
	});
	$( "#addresslist > li" ).live('click',function( event ) {
			var $item = $( this ),
				$target = $( event.target );
			if ( $target.is( "span.ui-icon-circle-plus" ) ) {
				add( $item );
			} else if ( $target.is( "span.ui-icon-circle-minus" ) ) {
				remove( $item );
			} else if ( $target.is( "a.ui-icon-refresh" ) ) {
				recycleImage( $item );
			}

			return false;
		});
	$( "#selectedcontainer  li" ).live('click',function( event ) {
			var $item = $( this ),
				$target = $( event.target );
			if ( $target.is( "span.ui-icon-circle-plus" ) ) {
				add( $item );
			} else if ( $target.is( "span.ui-icon-circle-minus" ) ) {
				remove( $item );
			}

			return false;
		});
	$( "#selectedcontainer   li" ).live('dblclick',function(){
		var $item = $( this );
		remove( $item );
	});
});
</script>
<title>发送反馈信息</title>
</head>
<body class="mainContent">
<city_list>文章信息</city_list>
</body>
</html>
